home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 8
/
FM Towns Free Software Collection 8.iso
/
t_os
/
otohime
/
src
/
lib
/
smix.asm
< prev
next >
Wrap
Assembly Source File
|
1994-06-01
|
2KB
|
139 lines
; SOUND DATA OVERLAP TRANS
;
; call from F-BASIC386 or High C
; callm address,varptr(source),varptr(new)
;
;
; 1990 3 Hiroshi TODA
;
; 1993 12 Hicg C用に改造
;
;
.386p
param struc
dd ?
dd ?
source dd ? ; source snd.data address
new dd ? ; new snd.data address
paradd dd ? ; param. address
wadd dd ? ; work address
param ends
work struc
;data area
rate1 dd ? ; main rate
rate2 dd ? ; trans source rate
max dd ? ; max data length
;work area
buf dd ?
work ends
cseg segment dword public use32 'CODE'
assume cs:cseg,ds:cseg
public sndMixTrans
db 'sndMixTrans',11
sndMixTrans proc near
push ebp
mov ebp,esp
push esi
push edi
push ebx
mov esi,[ebp].wadd ; esi <-- work area top add
mov ecx,[ebp].paradd ; ecx <-- para. add.
xor edx,edx ; edx=count
main01: mov eax,[ecx][edx*4] ; para. --> work area
mov [esi][edx*4],eax
inc edx
cmp edx,3
jb main01
mov ebx,[ebp].source ; ebx <-- source snd. add.
mov edi,[ebp].new ; edi <-- new snd. add.
; この部分の追加 1993 12
mov eax,[edi+12] ; max check ( new snd length )
cmp eax,[esi].max
jbe main0A0
mov eax,[esi].max
mov [edi+12],eax
main0A0:
mov ecx,[ebx+12] ; ecx <-- source data length
cmp ecx,[edi+12] ; new sndのlengthと比較
jae main0A5
main0A1:
mov byte ptr [ebx+32][ecx],128 ; はみ出た部分に0信号を置く
inc ecx
cmp ecx,[edi+12]
jb main0A1
main0A5:
mov ecx,[edi+12]
cmp ecx,0
je mainE
cmp ecx,[esi].max
jbe main0A
mov ecx,[esi].max
main0A: add ebx,32 ; add head(32Byte)
add edi,32
main02: mov al,[ebx] ; read source
and eax,0ffH
cmp eax,128
jb main03
mov edx,eax
mov eax,128
sub eax,edx
main03: imul eax,[esi].rate1
mov [esi].buf,eax
main04: mov al,[edi] ; read new
and eax,0ffH
cmp eax,128
jb main05
mov edx,eax
mov eax,128
sub eax,edx
main05: imul eax,[esi].rate2
add eax,[esi].buf
sar eax,8
cmp eax,0 ; write
js wr01
je wr01
cmp eax,128 ; +
jb wr02
mov eax,127
jmp wr02
wr01: mov edx,eax ; -
mov eax,128
sub eax,edx
cmp eax,256-1 ; data255はloopStopの意味があるから除外 1993 12
jb wr02
mov eax,255-1 ; data255はloopStopの意味があるから除外 1993 12
wr02: mov [edi],al
inc ebx
inc edi
dec ecx
jne main02
mainE:
pop ebx
pop edi
pop esi
mov esp,ebp
pop ebp
ret
sndMixTrans endp
cseg ends
end